package com.ybkj.chat.module.mine.activity;

import android.os.Bundle;
import android.support.v4.view.ViewPager;

import com.androidkun.xtablayout.XTabLayout;
import com.ybkj.chat.R;
import com.ybkj.chat.base.BaseMvpActivity;
import com.ybkj.chat.module.mine.fragment.CashFragment;
import com.ybkj.chat.module.mine.fragment.CircleCoinFragement;
import com.ybkj.chat.module.mine.presenter.ChargeRecordPresenter;
import com.ybkj.chat.module.mine.view.ChargeRecordView;
import com.ybkj.chat.ui.adapter.ViewPagerAdapter;

import butterknife.BindView;
import butterknife.ButterKnife;

/**
 * @author yyj
 * @create 2019-02-15 14:49
 * @Describe 消费记录
 */
public class ChargeRecordActivity extends BaseMvpActivity<ChargeRecordPresenter> implements ChargeRecordView {
    @BindView(R.id.tab)
    XTabLayout tab;
    @BindView(R.id.vp_pager)
    ViewPager vpPager;

    private ViewPagerAdapter viewPagerAdapter;

    @Override
    protected void injectPresenter() {

    }

    @Override
    protected void initTitle() {
        setTitleText("消费记录");
    }

    @Override
    protected int getLayoutId() {
        return R.layout.activity_charge_record;
    }

    @Override
    protected void initView() {
        viewPagerAdapter = new ViewPagerAdapter(getSupportFragmentManager());
        tab.addTab(tab.newTab().setText("现金"));
        tab.addTab(tab.newTab().setText("圈币"));

        CashFragment cashFragment = new CashFragment();
        CircleCoinFragement circleCoinFragement = new CircleCoinFragement();
        viewPagerAdapter.addFragment(cashFragment, "现金");
        viewPagerAdapter.addFragment(circleCoinFragement,"圈币");
        vpPager.setAdapter(viewPagerAdapter);
        if (tab != null) {
            tab.setupWithViewPager(vpPager);
        }
    }

    @Override
    protected void initData() {

    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        // TODO: add setContentView(...) invocation
        ButterKnife.bind(this);
    }
}
